import numpy as np
from PIL import Image
import cv2

#使用拉普拉斯算子进行操作
imgfile = "2.png"
image=cv2.imread(imgfile)
kernel = np.array([[0, -1, 0], [-1, 5, -1], [0, -1, 0]])
LaplacePic=cv2.filter2D(image,-1,kernel)


# cv2.imshow("Original", image)
# cv2.imshow("Laplace", LaplacePic)
cv2.imwrite('2l.png', LaplacePic)
cv2.waitKey(0)